Let $E_{\text{cell}}$ be the cell potential,$E_{\text{cell}}^{\circ}$ be the standard cell potential,and $[A], [B], [C], [D]$ be the molar concentrations of the species $A, B, C, D$ respectively.
The Gibbs free energy change for the reaction is given by $\Delta G = \Delta G^{\circ} + RT \ln Q$,where $Q$ is the reaction quotient.
Since $\Delta G = -nFE_{\text{cell}}$ and $\Delta G^{\circ} = -nFE_{\text{cell}}^{\circ}$,we substitute these into the equation:
$-nFE_{\text{cell}} = -nFE_{\text{cell}}^{\circ} + RT \ln Q$
Dividing by $-nF$,we get the Nernst equation:
$E_{\text{cell}} = E_{\text{cell}}^{\circ} - \frac{RT}{nF} \ln \frac{[C]^{c}[D]^{d}}{[A]^{a}[B]^{b}}$
At $298 \ K$,using $\ln x = 2.303 \log_{10} x$ and substituting constants $R = 8.314 \ J \ K^{-1} \ mol^{-1}$ and $F = 96487 \ C \ mol^{-1}$,the equation becomes:
$E_{\text{cell}} = E_{\text{cell}}^{\circ} - \frac{0.0591}{n} \log_{10} \frac{[C]^{c}[D]^{d}}{[A]^{a}[B]^{b}}$